package rensoft.portfolio.client.view;

import static com.google.gwt.query.client.GQuery.$;

import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget;

import cs.java.lang.HasService;


import rensoft.gwt.client.view.View;
import rensoft.portfolio.client.model.titles.Titles.TitleState;
import rensoft.portfolio.client.view.viewer.ViewerWidget;
import rensoft.portfolio.client.view.workslides.WorksSlidesWidget;

public class PortfolioWidget extends View<FlowPanel> {

  private static Binder uiBinder = GWT.create(Binder.class);

  @UiField
  TitleButton buttonDetails;

  @UiField
  TitleButton buttonDone;
  @UiField
  TitleButton buttonOffer;
  @UiField
  Widget buttonsPanel;
  @UiField
  ViewerWidget pageViewer;
  @UiField
  Widget portfolioWidget;
  @UiField
  WorksSlidesWidget worksSlides;

  public PortfolioWidget() {
    initWidget(uiBinder.createAndBindUi(this));
  }

  @Override
  public void initialize(HasService parent) {
    super.initialize(parent);
    $(asWidget()).fadeIn();
    worksSlides.initialize(this);
    pageViewer.initialize(this);
    buttonDetails.initialize(this, TitleState.contact);
    buttonDone.initialize(this, TitleState.products);
    buttonOffer.initialize(this, TitleState.services);
    getService().serve(WorksSlidesWidget.class, worksSlides);
  }

  interface Binder extends UiBinder<FlowPanel, PortfolioWidget> {}
}
